/**
 * Copyright 2016 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
*/

// DO NOT EDIT THIS GENERATED OUTPUT DIRECTLY!
// This file should be overwritten as part of your build process.
// If you need to extend the behavior of the generated service worker, the best approach is to write
// additional code and include it using the importScripts option:
//   https://github.com/GoogleChrome/sw-precache#importscripts-arraystring
//
// Alternatively, it's possible to make changes to the underlying template file and then use that as the
// new base for generating output, via the templateFilePath option:
//   https://github.com/GoogleChrome/sw-precache#templatefilepath-string
//
// If you go that route, make sure that whenever you update your sw-precache dependency, you reconcile any
// changes made to this original template file with your modified copy.

// This generated service worker JavaScript will precache your site's resources.
// The code needs to be saved in a .js file at the top-level of your site, and registered
// from your pages in order to be used. See
// https://github.com/googlechrome/sw-precache/blob/master/demo/app/js/service-worker-registration.js
// for an example of how you can register this script and handle various service worker events.

/* eslint-env worker, serviceworker */
/* eslint-disable indent, no-unused-vars, no-multiple-empty-lines, max-nested-callbacks, space-before-function-paren, quotes, comma-spacing */
'use strict';

var precacheConfig = [["E:/BorenHU.gitee.io/public/404.html","813b53ac5aaf3bd52da663ae7b4f6e24"],["E:/BorenHU.gitee.io/public/about/index.html","70b8e2bd95e51078b8d2a2dff98fbfc3"],["E:/BorenHU.gitee.io/public/archives/2020/03/index.html","f1783c3e5304c034e8a75bf02a632d85"],["E:/BorenHU.gitee.io/public/archives/2020/03/page/2/index.html","46b2c4f1abb8ad7230c773332fe6874b"],["E:/BorenHU.gitee.io/public/archives/2020/04/index.html","eae88d9081227672395f565307950b47"],["E:/BorenHU.gitee.io/public/archives/2020/04/page/2/index.html","dc01c80ad97c8de8753be57ec24fcd55"],["E:/BorenHU.gitee.io/public/archives/2020/04/page/3/index.html","d9ed8a8063d7e5f9cef53f90e1d2d072"],["E:/BorenHU.gitee.io/public/archives/2020/04/page/4/index.html","f860147da457adf78cc9e55ae4e2d264"],["E:/BorenHU.gitee.io/public/archives/2020/05/index.html","466809428b2b047a6ed275f1cc745d95"],["E:/BorenHU.gitee.io/public/archives/2020/index.html","989c8dcb2f6c1ddb6ad82ffee12860a9"],["E:/BorenHU.gitee.io/public/archives/2020/page/2/index.html","2094ebc6cb8ccf226f082db93d6688a0"],["E:/BorenHU.gitee.io/public/archives/2020/page/3/index.html","93569dc169b3ab436f5b6495d8c231b6"],["E:/BorenHU.gitee.io/public/archives/2020/page/4/index.html","3c5e658c315564a0618ab2565be14d57"],["E:/BorenHU.gitee.io/public/archives/2020/page/5/index.html","43d2cd9df416fe46490bc040ed780c7f"],["E:/BorenHU.gitee.io/public/archives/2020/page/6/index.html","a971cfee0bb0f1e7597b66ba9c4b9af2"],["E:/BorenHU.gitee.io/public/archives/index.html","0cbf0a4eb447d58a5260fa3e1332226f"],["E:/BorenHU.gitee.io/public/archives/page/2/index.html","0cbf0a4eb447d58a5260fa3e1332226f"],["E:/BorenHU.gitee.io/public/archives/page/3/index.html","0cbf0a4eb447d58a5260fa3e1332226f"],["E:/BorenHU.gitee.io/public/archives/page/4/index.html","0cbf0a4eb447d58a5260fa3e1332226f"],["E:/BorenHU.gitee.io/public/archives/page/5/index.html","0cbf0a4eb447d58a5260fa3e1332226f"],["E:/BorenHU.gitee.io/public/archives/page/6/index.html","0cbf0a4eb447d58a5260fa3e1332226f"],["E:/BorenHU.gitee.io/public/books/index.html","5bec2beb5706ceca7ebd2fc326f9dd50"],["E:/BorenHU.gitee.io/public/categories/C语言/index.html","4875f79f493a3bb71ef4f0384195717d"],["E:/BorenHU.gitee.io/public/categories/English/index.html","a4292f595b9f7dc2be8aa9b7ffb41c15"],["E:/BorenHU.gitee.io/public/categories/Java/index.html","0aec4eb3ff6078fe718a10f1d27b14b2"],["E:/BorenHU.gitee.io/public/categories/Java/page/2/index.html","e109e72e6c9ea9592565ddabe87083bf"],["E:/BorenHU.gitee.io/public/categories/Java/page/3/index.html","644e8700ea81db8418409a688b9cf425"],["E:/BorenHU.gitee.io/public/categories/LeetCode/index.html","de8c48ec7c125e3834447efb13cd0152"],["E:/BorenHU.gitee.io/public/categories/Linux/index.html","386521fcfa8f5ce99db5e11d31eef631"],["E:/BorenHU.gitee.io/public/categories/MySql/index.html","3a06372e38c944891b8d51ddf7640cd4"],["E:/BorenHU.gitee.io/public/categories/Php/index.html","adb389f23fcd3545f57217ce6a6eee86"],["E:/BorenHU.gitee.io/public/categories/Self-investment/index.html","4d4a234d77ef9f6d68ed041c01a35884"],["E:/BorenHU.gitee.io/public/categories/Spring/index.html","84194773947b35295bc92f9380670386"],["E:/BorenHU.gitee.io/public/categories/Web前端/index.html","0ed833860b8b26f73c9f0493b7c9c14a"],["E:/BorenHU.gitee.io/public/categories/WechatApplet/index.html","3bb351f42973c06abea879f787d1bfcc"],["E:/BorenHU.gitee.io/public/categories/index.html","1a0ee7bae61fc6e1e646954a0e304f4c"],["E:/BorenHU.gitee.io/public/categories/数据结构与算法/index.html","feafdeecb1d6215932a5914c0da39500"],["E:/BorenHU.gitee.io/public/categories/网络编程/index.html","4aa9e3455849202e1a049896619a4a4a"],["E:/BorenHU.gitee.io/public/categories/计算机理论/index.html","b40257e219c6acb4799aee7050270ad2"],["E:/BorenHU.gitee.io/public/contact/index.html","730235a6da87c95d27d641f5bbef4332"],["E:/BorenHU.gitee.io/public/css/style.css","81a92e5bec99f94f07342a7b9a014050"],["E:/BorenHU.gitee.io/public/fonts/Monaco.ttf","7d1b5cf51af724a2641a89a881b342fe"],["E:/BorenHU.gitee.io/public/fonts/Skranji-Regular.ttf","0f860580e235e4ae4ae655c2bbb9c943"],["E:/BorenHU.gitee.io/public/fonts/Ubuntu-Regular.ttf","75adbf87abbf62e27f6a738caeb71f75"],["E:/BorenHU.gitee.io/public/friends/index.html","564f2a249ca655e6bb90656453ca7a0a"],["E:/BorenHU.gitee.io/public/go.html","54edbe4525f8ab0fd7b66e1e9a2bb69a"],["E:/BorenHU.gitee.io/public/images/loading.gif","3839714eb7fe736c775a2a3ccfb4024e"],["E:/BorenHU.gitee.io/public/img/algolia.svg","7907ab6b9a7b05076e0751fa3a0bda3a"],["E:/BorenHU.gitee.io/public/img/azure.svg","570248db796e292bf7b59a650cd079c8"],["E:/BorenHU.gitee.io/public/img/baidu.svg","dc8c2616588c33ff4f70f43579c639d6"],["E:/BorenHU.gitee.io/public/index.html","33d950c199109654741fd43b27dcb2a2"],["E:/BorenHU.gitee.io/public/js/FunnyTitle.js","a69afd1c6c40e4fd458e803bb44b6ba5"],["E:/BorenHU.gitee.io/public/js/app.js","ea306851b6276a0ffeec351d138589e5"],["E:/BorenHU.gitee.io/public/js/echarts.min.js","f568f8fd3bb047a98ece7980cba82e26"],["E:/BorenHU.gitee.io/public/js/love.js","eee8f2c2bd37bca027d4fe044be30794"],["E:/BorenHU.gitee.io/public/js/search.js","8c5e55f8a12105822ef6793c880f0aa7"],["E:/BorenHU.gitee.io/public/js/valine.js","c5c9473e2af6ab5fe16ffbb0bd09c6a7"],["E:/BorenHU.gitee.io/public/moves/index.html","ad437696b16cbf64c64cd4b3d0378a67"],["E:/BorenHU.gitee.io/public/mylist/index.html","82b4b68a2d7232143290150f363122c9"],["E:/BorenHU.gitee.io/public/page/2/index.html","95ca445d6f3ad3f8a69128e585e884bb"],["E:/BorenHU.gitee.io/public/page/3/index.html","724482bb50c5f17af702e98c0d1fd7b0"],["E:/BorenHU.gitee.io/public/page/4/index.html","14dcd17547a187c07eacc66a4ab43981"],["E:/BorenHU.gitee.io/public/page/5/index.html","3bc01b94356bdb1607a6497cbb23ac49"],["E:/BorenHU.gitee.io/public/page/6/index.html","6ae2f4e2821e6c051f0b8e7fd75e94c6"],["E:/BorenHU.gitee.io/public/posts/10186.html","d4a463cf94f9262df99009ba2a0ba529"],["E:/BorenHU.gitee.io/public/posts/10501.html","b918668f3f18f2850d46e8d9e73786da"],["E:/BorenHU.gitee.io/public/posts/10592.html","dc8bfbc155c42737b93b980f24871884"],["E:/BorenHU.gitee.io/public/posts/10844.html","723d8e2fb7d258716804992229df01f8"],["E:/BorenHU.gitee.io/public/posts/10947.html","c06686fad4a75bfdb5cca0a2433529c0"],["E:/BorenHU.gitee.io/public/posts/12480.html","23c5c597a5a1282754f3c914f4c64f24"],["E:/BorenHU.gitee.io/public/posts/12481.html","41d53637b01886724088b86fcc2eec29"],["E:/BorenHU.gitee.io/public/posts/14246.html","95da884519e9f7d01c377ea791e6d810"],["E:/BorenHU.gitee.io/public/posts/14359.html","34f516e4e71ac651eea576eeb25de1c8"],["E:/BorenHU.gitee.io/public/posts/15174.html","bcff9036ac535c1c082ca4b301a8b67f"],["E:/BorenHU.gitee.io/public/posts/1556.html","89d291cdf476469e3228e4a75788304c"],["E:/BorenHU.gitee.io/public/posts/16083.html","1c1e7db0d946e90a8318f7e0d7fd2d52"],["E:/BorenHU.gitee.io/public/posts/1620.html","4aa8d71afa95e0edfe67e383731df869"],["E:/BorenHU.gitee.io/public/posts/20994.html","4248090b170d5170de94948a530539bb"],["E:/BorenHU.gitee.io/public/posts/21038.html","328f0618ae1575c527db6e1a6f4ada18"],["E:/BorenHU.gitee.io/public/posts/21343.html","1ac3865fa4dbc3ab21b68d5c64eb1d79"],["E:/BorenHU.gitee.io/public/posts/22997.html","1f481f9e9d1cd2ed10135c1fef367af8"],["E:/BorenHU.gitee.io/public/posts/23019.html","6d18599920172f9512e9139dd13d3b7a"],["E:/BorenHU.gitee.io/public/posts/23251.html","33c72cf0d666cce26c0ee4f3a668488a"],["E:/BorenHU.gitee.io/public/posts/23753.html","1f9ad8aa776785ce39d9a4573df674ec"],["E:/BorenHU.gitee.io/public/posts/24821.html","f2b73071cc04accf24b24fe5621d8920"],["E:/BorenHU.gitee.io/public/posts/24855.html","5a10fc61d7b10aa918c0a470202c7108"],["E:/BorenHU.gitee.io/public/posts/26235.html","f31b55d71aab244c29910d4c20b2c647"],["E:/BorenHU.gitee.io/public/posts/26720.html","7d23416686f692ae5c7935c4e4e329a6"],["E:/BorenHU.gitee.io/public/posts/27741.html","0270c9890942314fed15e4a1d412593c"],["E:/BorenHU.gitee.io/public/posts/29215.html","c5fd0b6ab180b69abe6f844be8f790b3"],["E:/BorenHU.gitee.io/public/posts/2996.html","6ade97d9037daaa3398a48fa5ce1f83b"],["E:/BorenHU.gitee.io/public/posts/30829.html","ace90ebdae02a50d55443538ef0b1e42"],["E:/BorenHU.gitee.io/public/posts/31973.html","08a2e0c02634d80c8ca014b8bdb883b3"],["E:/BorenHU.gitee.io/public/posts/34189.html","219d9295ea394ac9318137ca34da83ee"],["E:/BorenHU.gitee.io/public/posts/34699.html","bc12da665f37d5e49ce7186e070e1b9e"],["E:/BorenHU.gitee.io/public/posts/35.html","d49ed942e6be590cff3db6a5d1d44ce6"],["E:/BorenHU.gitee.io/public/posts/35367.html","2318c8332ccab8f8db09e4f54eeb00ba"],["E:/BorenHU.gitee.io/public/posts/35603.html","bdd3c0f5f2ca9ce5d27ba0e6946d3372"],["E:/BorenHU.gitee.io/public/posts/36483.html","755c084592f75c5e11c484999fe9ea45"],["E:/BorenHU.gitee.io/public/posts/37228.html","421f3567cc41a31605cf595b392a9dd6"],["E:/BorenHU.gitee.io/public/posts/3802.html","7ccdd6b4240531d5ceda4f1c04446de5"],["E:/BorenHU.gitee.io/public/posts/39070.html","c4fdda2b747a40bb027c8e69aa56ca37"],["E:/BorenHU.gitee.io/public/posts/41513.html","259528687fca60d82b022a72e1e2bea2"],["E:/BorenHU.gitee.io/public/posts/42079.html","32a9a0ac85f3fbd9422c30406a282507"],["E:/BorenHU.gitee.io/public/posts/43130.html","a65f52fc2e4407b62b948827816dd9b4"],["E:/BorenHU.gitee.io/public/posts/433.html","3ad7fe4925742025acb710e2f89d8a67"],["E:/BorenHU.gitee.io/public/posts/44633.html","7df6994d111b0bc31dd357c0d9fcd8db"],["E:/BorenHU.gitee.io/public/posts/46347.html","ca1c7348ecc4e73eafa26615f96a19b7"],["E:/BorenHU.gitee.io/public/posts/46972.html","6204e690872ac91fd2425f6d4a68f76c"],["E:/BorenHU.gitee.io/public/posts/47880.html","aac9ec5406bafd44cc530c16b09f0ae0"],["E:/BorenHU.gitee.io/public/posts/4795.html","dc1ee13771563cb8563cc726ac9116e2"],["E:/BorenHU.gitee.io/public/posts/48227.html","23d9048f7a470997af92d3ff67e95937"],["E:/BorenHU.gitee.io/public/posts/48707.html","1a912d64a6f74314ef678a9aed495143"],["E:/BorenHU.gitee.io/public/posts/50246.html","57c31c96705125e7a46b566918a9e16c"],["E:/BorenHU.gitee.io/public/posts/50515.html","364528e666038c266c05ff4f58c1b05e"],["E:/BorenHU.gitee.io/public/posts/51726.html","aa397f2fa17f906f2f37413fb6ce0bc5"],["E:/BorenHU.gitee.io/public/posts/51842.html","8d1cf929337ae59f00f0dfa3576c3806"],["E:/BorenHU.gitee.io/public/posts/53103.html","41e1c2ace9787c20bd20176214d769f0"],["E:/BorenHU.gitee.io/public/posts/53195.html","1f68f3a0f30fb9ad23c5fe67054d65a7"],["E:/BorenHU.gitee.io/public/posts/54645.html","bc231e268372cbae124c72ce947bb111"],["E:/BorenHU.gitee.io/public/posts/5692.html","0680a4c163f665466becf87175e992ce"],["E:/BorenHU.gitee.io/public/posts/62354.html","f038d6928314b414abd34cf0aba763e2"],["E:/BorenHU.gitee.io/public/posts/65065.html","1f018c39b46305d471b39d89fa0a947a"],["E:/BorenHU.gitee.io/public/posts/8314.html","2f0990a1656c6fbff01c1224c73cad7f"],["E:/BorenHU.gitee.io/public/posts/8339.html","6aab4f3288bd5494f7fca7edd49a689d"],["E:/BorenHU.gitee.io/public/posts/8684.html","61950393ca0e08169407d30df12a76f5"],["E:/BorenHU.gitee.io/public/posts/9677.html","cde476a22ce07253019ae97caeae2116"],["E:/BorenHU.gitee.io/public/sponsor/index.html","422515187d29f76829fc51df4b3227f3"],["E:/BorenHU.gitee.io/public/tags/C语言/index.html","c002811970a8a5e056678448d9457cd2"],["E:/BorenHU.gitee.io/public/tags/English/index.html","28968bb4d95d279b82083c4dfeea25f5"],["E:/BorenHU.gitee.io/public/tags/GUI/index.html","b4a0207d7973912d684e2230e0fba36e"],["E:/BorenHU.gitee.io/public/tags/Html/index.html","2b895103b845e629fa4305fa14b17c15"],["E:/BorenHU.gitee.io/public/tags/Java/index.html","24bd324a9d5e3a3c576f5ab26fd5a603"],["E:/BorenHU.gitee.io/public/tags/Java/page/2/index.html","866c4bace663ca1f03dad019f7f639fa"],["E:/BorenHU.gitee.io/public/tags/Java/page/3/index.html","f28c1afcaafa03960296355d4e39ad30"],["E:/BorenHU.gitee.io/public/tags/JavaEE/index.html","d3140289e69e631c79882863b858ddfb"],["E:/BorenHU.gitee.io/public/tags/JavaScript/index.html","62bac16c03db76c7cc94bec661bdc208"],["E:/BorenHU.gitee.io/public/tags/LeetCode/index.html","8b5ebc1066a0b2bdc3289ff0575c5e87"],["E:/BorenHU.gitee.io/public/tags/Linux/index.html","96e52302f208d5da3737e92d0766fe48"],["E:/BorenHU.gitee.io/public/tags/MySql/index.html","0f5c207b08016da92d6eed87a1af40b4"],["E:/BorenHU.gitee.io/public/tags/Php/index.html","5f5f6398eb1c7a1ee73fe08d1272e6ce"],["E:/BorenHU.gitee.io/public/tags/Self-investment/index.html","dfe4191ce827533c063fe0a28ab92045"],["E:/BorenHU.gitee.io/public/tags/Spring/index.html","231aa0c4d160f66db286cb95994653a2"],["E:/BorenHU.gitee.io/public/tags/Web前端/index.html","66fc38fa877de96d8418adcde0772926"],["E:/BorenHU.gitee.io/public/tags/WechatApplet/index.html","6f48b9ce3aa9bb1cd464553618f8e70e"],["E:/BorenHU.gitee.io/public/tags/index.html","afa658a0d3c68e4d82889c59061682f5"],["E:/BorenHU.gitee.io/public/tags/多线程/index.html","82258ba6f41998885200e8846850a712"],["E:/BorenHU.gitee.io/public/tags/指针/index.html","c6ddcec9e2c22ea9070c1ea9ad7d09c8"],["E:/BorenHU.gitee.io/public/tags/数据结构与算法/index.html","126e9e6438f2aaa4d2e402a86d05898a"],["E:/BorenHU.gitee.io/public/tags/网络编程/index.html","0b057204b1341c9494d29bac1fc59f21"],["E:/BorenHU.gitee.io/public/tags/虚拟机/index.html","1d11b6e8fa6ba181a9cbd16479a60937"],["E:/BorenHU.gitee.io/public/tags/计算机理论/index.html","b812e35fbf1550e13309bc6d134c8ba7"]];
var cacheName = 'sw-precache-v3--' + (self.registration ? self.registration.scope : '');


var ignoreUrlParametersMatching = [/^utm_/];



var addDirectoryIndex = function(originalUrl, index) {
    var url = new URL(originalUrl);
    if (url.pathname.slice(-1) === '/') {
      url.pathname += index;
    }
    return url.toString();
  };

var cleanResponse = function(originalResponse) {
    // If this is not a redirected response, then we don't have to do anything.
    if (!originalResponse.redirected) {
      return Promise.resolve(originalResponse);
    }

    // Firefox 50 and below doesn't support the Response.body stream, so we may
    // need to read the entire body to memory as a Blob.
    var bodyPromise = 'body' in originalResponse ?
      Promise.resolve(originalResponse.body) :
      originalResponse.blob();

    return bodyPromise.then(function(body) {
      // new Response() is happy when passed either a stream or a Blob.
      return new Response(body, {
        headers: originalResponse.headers,
        status: originalResponse.status,
        statusText: originalResponse.statusText
      });
    });
  };

var createCacheKey = function(originalUrl, paramName, paramValue,
                           dontCacheBustUrlsMatching) {
    // Create a new URL object to avoid modifying originalUrl.
    var url = new URL(originalUrl);

    // If dontCacheBustUrlsMatching is not set, or if we don't have a match,
    // then add in the extra cache-busting URL parameter.
    if (!dontCacheBustUrlsMatching ||
        !(url.pathname.match(dontCacheBustUrlsMatching))) {
      url.search += (url.search ? '&' : '') +
        encodeURIComponent(paramName) + '=' + encodeURIComponent(paramValue);
    }

    return url.toString();
  };

var isPathWhitelisted = function(whitelist, absoluteUrlString) {
    // If the whitelist is empty, then consider all URLs to be whitelisted.
    if (whitelist.length === 0) {
      return true;
    }

    // Otherwise compare each path regex to the path of the URL passed in.
    var path = (new URL(absoluteUrlString)).pathname;
    return whitelist.some(function(whitelistedPathRegex) {
      return path.match(whitelistedPathRegex);
    });
  };

var stripIgnoredUrlParameters = function(originalUrl,
    ignoreUrlParametersMatching) {
    var url = new URL(originalUrl);
    // Remove the hash; see https://github.com/GoogleChrome/sw-precache/issues/290
    url.hash = '';

    url.search = url.search.slice(1) // Exclude initial '?'
      .split('&') // Split into an array of 'key=value' strings
      .map(function(kv) {
        return kv.split('='); // Split each 'key=value' string into a [key, value] array
      })
      .filter(function(kv) {
        return ignoreUrlParametersMatching.every(function(ignoredRegex) {
          return !ignoredRegex.test(kv[0]); // Return true iff the key doesn't match any of the regexes.
        });
      })
      .map(function(kv) {
        return kv.join('='); // Join each [key, value] array into a 'key=value' string
      })
      .join('&'); // Join the array of 'key=value' strings into a string with '&' in between each

    return url.toString();
  };


var hashParamName = '_sw-precache';
var urlsToCacheKeys = new Map(
  precacheConfig.map(function(item) {
    var relativeUrl = item[0];
    var hash = item[1];
    var absoluteUrl = new URL(relativeUrl, self.location);
    var cacheKey = createCacheKey(absoluteUrl, hashParamName, hash, false);
    return [absoluteUrl.toString(), cacheKey];
  })
);

function setOfCachedUrls(cache) {
  return cache.keys().then(function(requests) {
    return requests.map(function(request) {
      return request.url;
    });
  }).then(function(urls) {
    return new Set(urls);
  });
}

self.addEventListener('install', function(event) {
  event.waitUntil(
    caches.open(cacheName).then(function(cache) {
      return setOfCachedUrls(cache).then(function(cachedUrls) {
        return Promise.all(
          Array.from(urlsToCacheKeys.values()).map(function(cacheKey) {
            // If we don't have a key matching url in the cache already, add it.
            if (!cachedUrls.has(cacheKey)) {
              var request = new Request(cacheKey, {credentials: 'same-origin'});
              return fetch(request).then(function(response) {
                // Bail out of installation unless we get back a 200 OK for
                // every request.
                if (!response.ok) {
                  throw new Error('Request for ' + cacheKey + ' returned a ' +
                    'response with status ' + response.status);
                }

                return cleanResponse(response).then(function(responseToCache) {
                  return cache.put(cacheKey, responseToCache);
                });
              });
            }
          })
        );
      });
    }).then(function() {
      
      // Force the SW to transition from installing -> active state
      return self.skipWaiting();
      
    })
  );
});

self.addEventListener('activate', function(event) {
  var setOfExpectedUrls = new Set(urlsToCacheKeys.values());

  event.waitUntil(
    caches.open(cacheName).then(function(cache) {
      return cache.keys().then(function(existingRequests) {
        return Promise.all(
          existingRequests.map(function(existingRequest) {
            if (!setOfExpectedUrls.has(existingRequest.url)) {
              return cache.delete(existingRequest);
            }
          })
        );
      });
    }).then(function() {
      
      return self.clients.claim();
      
    })
  );
});


self.addEventListener('fetch', function(event) {
  if (event.request.method === 'GET') {
    // Should we call event.respondWith() inside this fetch event handler?
    // This needs to be determined synchronously, which will give other fetch
    // handlers a chance to handle the request if need be.
    var shouldRespond;

    // First, remove all the ignored parameters and hash fragment, and see if we
    // have that URL in our cache. If so, great! shouldRespond will be true.
    var url = stripIgnoredUrlParameters(event.request.url, ignoreUrlParametersMatching);
    shouldRespond = urlsToCacheKeys.has(url);

    // If shouldRespond is false, check again, this time with 'index.html'
    // (or whatever the directoryIndex option is set to) at the end.
    var directoryIndex = 'index.html';
    if (!shouldRespond && directoryIndex) {
      url = addDirectoryIndex(url, directoryIndex);
      shouldRespond = urlsToCacheKeys.has(url);
    }

    // If shouldRespond is still false, check to see if this is a navigation
    // request, and if so, whether the URL matches navigateFallbackWhitelist.
    var navigateFallback = '';
    if (!shouldRespond &&
        navigateFallback &&
        (event.request.mode === 'navigate') &&
        isPathWhitelisted([], event.request.url)) {
      url = new URL(navigateFallback, self.location).toString();
      shouldRespond = urlsToCacheKeys.has(url);
    }

    // If shouldRespond was set to true at any point, then call
    // event.respondWith(), using the appropriate cache key.
    if (shouldRespond) {
      event.respondWith(
        caches.open(cacheName).then(function(cache) {
          return cache.match(urlsToCacheKeys.get(url)).then(function(response) {
            if (response) {
              return response;
            }
            throw Error('The cached response that was expected is missing.');
          });
        }).catch(function(e) {
          // Fall back to just fetch()ing the request if some unexpected error
          // prevented the cached response from being valid.
          console.warn('Couldn\'t serve response for "%s" from cache: %O', event.request.url, e);
          return fetch(event.request);
        })
      );
    }
  }
});







